package com.kc.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kc.bean.GroudPermission;
import com.kc.mapper.GroudPermissionMapper;
import com.kc.service.IGroudPermissionService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-10-17
 */
@Service
public class GroudPermissionServiceImpl extends ServiceImpl<GroudPermissionMapper, GroudPermission> implements IGroudPermissionService {

    @Resource
    private GroudPermissionMapper groudPermissionMapper;

    @Override
    public List<String> GetPermission(String id) {
        return groudPermissionMapper.GetPermission(Wrappers.<GroudPermission>lambdaQuery().le(GroudPermission::getAccountId,id));
    }


    @Async
    @Override
    public CompletableFuture<Integer> instPermission(GroudPermission groudPermission) {
        int i = groudPermissionMapper.insert(groudPermission);
        return CompletableFuture.completedFuture(i);
    }
}
